# -*- coding: utf-8 -*-

"""
DateTime   : 2020/12/17 15:49
Author     : ZhangYafei
Description: 被装饰函数不带参数
"""
import time


def record_time(func):
    def wrapper():
        start_time = time.time()
        func()
        end_time = time.time()
        print('spend is {}'.format(end_time - start_time))

    return wrapper


@record_time       # 得到闭包函数record_time, add = record_time(add)
def func():
    print('func do something!')
    time.sleep(1)


func()
"""
func do something!
spend is 1.0044233798980713
"""